<%-- 
    Document   : group
    Created on : Apr 28, 2013, 7:11:47 PM
    Author     : wan.fairul
--%>
<%@ include file="/WEB-INF/jsp/include/page_header.jspf" %>
<%@ taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>.: Admin : Add Email :.</title>    
        <script type="text/javascript">
            $(function() {
                $("#dialog-form").dialog({
                    autoOpen: false,
                    height: 500,
                    width: 600,
                    modal: true,
                    buttons: {
                        "Save": function() {
                            var frm = document.forms.popupForm;
                            frm.action = frm.action + '?saveEditGroup';
                            frm.submit();
                        },
                        Cancel: function() {
                            $(this).dialog("close");
                        }
                    },
                    close: function() {
                    }
                });

            });

            function removeEmail(val) {
                var form = document.form1;
                var answer = confirm("Delete?");
                if (answer) {
                    form.action = '${pageContext.request.contextPath}/adminEmail?deleteEmail&emailId=' + val;
                    form.submit();
                }
            }

            function unblockUI() {
                $.unblockUI();
            }

            function blockUI() {
                $.blockUI();
            }

            function editEmail(groupId) {
                var url = '${pageContext.request.contextPath}/adminEmail?popupEditEmail&groupId=' + groupId;
                $.get(url, function(data) {
                    $('#dialog-form').html(data);
                });
                $("#dialog-form").dialog("open");
            }

            function validateFirst() {
                var validate = true;
                var message = "All field are required";
                if ($("#title").val() === '')
                    validate = false;
                 if ($("#content").val() === '')
                    validate = false;
                if (validate === false)
                    alert(message);
                return validate;
            }
        </script>
    </head>
    <body>
        <s:messages/>
        <s:errors/>
        <s:useActionBean beanclass="exatrez.stripes.util.ListUtil" var="list"/>
        <s:form beanclass="exatrez.stripes.action.EmailAction" name="form1">           
            <div>
                <fieldset>
                    <div id="page-title">
                        <span class="title">Add Email</span>
                    </div>
                    <p>
                        <label>Title :</label>
                        <s:text name="email.groupName" class="uppercase" id="title" style="width:250px"/>
                    </p> 
                    <p>
                        <label>Content :</label>
                        <s:textarea name="email.groupName" class="uppercase" id="content" rows="5" cols="70"/>
                    </p> 
                    <label>&nbsp;</label>
                    <s:submit name="saveEmail" value="Submit" class="btn" onclick="return validateFirst()"/>
                    <s:button name="clear" value="Clear" class="btn"/>
                    </p>
                </fieldset>
            </div>
        </s:form>
        <div id="dialog-form" title="Edit Email">
        </div>
    </body>
</html>
